package com.lepai.web.interception;

import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.springframework.ui.ModelMap;
import org.springframework.web.context.request.AsyncWebRequestInterceptor;
import org.springframework.web.context.request.WebRequest;

/**
 * @author weihaolong
 * @date 2018-11-07 10:39
 */
public class DefaultWebInterception implements AsyncWebRequestInterceptor {

    Logger logger = LogManager.getLogger(getClass());

    @Override
    public void preHandle(WebRequest request) throws Exception {
        logger.info("进入web拦截器!!!");
        return;
    }

    @Override
    public void postHandle(WebRequest request, ModelMap model) throws Exception {
        logger.info("setResult返回之后");
    }

    @Override
    public void afterCompletion(WebRequest request, Exception ex) throws Exception {
        logger.info("请求处理完成之后");
    }

    @Override
    public void afterConcurrentHandlingStarted(WebRequest request) {
        logger.info("controller方法执行结束返回之后");
    }
}
